package com.ccb.sc.common.modules.order.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author ken
 * @version 1.0
 * @date 2020-09-25
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum OrderReturnType implements IEnum<Integer> {

    /**
     * 退货退款
     */
    RETURN_REFUND(1, "退货退款"),

    /**
     * 仅退款
     */
    ONLY_REFUND(2, "仅退款"),

    /**
     * 换货
     */
    EXCHANGE(3, "换货"),
    ;

    private int value;
    private String desc;

    OrderReturnType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static OrderReturnType getByValue(int value) {
        for (OrderReturnType orderStatus : OrderReturnType.values()) {
            if (value == orderStatus.getValue()) {
                return orderStatus;
            }
        }
        return null;
    }
}
